﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using Common;
using System.Diagnostics;
using System.Threading;

namespace WASBasicService
{
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Multiple)]
    public class BasicSingleService : IBasicService, IDisposable
    {
        void IBasicService.DoWork(string clientId, int repetition)
        {
            Debug.WriteLine(string.Format("Processing request {0} from Client {1}, Timestamp: {2}", repetition, clientId, DateTime.Now.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffzz")));

            Thread.Sleep(500);

            Debug.WriteLine(string.Format("Request {1} from Client {0} completed", clientId, repetition));
        }

        public void Dispose()
        {
            Debug.WriteLine("Disposing of service");

            GC.SuppressFinalize(this);
        }

        public BasicSingleService()
        {
            Debug.WriteLine("Creating service instance");
        }
    }
}
